![在这里插入图片描述](https://img-blog.csdnimg.cn/afab85e668c34916b1a68f8e5cd5ed69.png)
由于ppt中不能插入视频资源文件,但是因公司要求,在pptx中插入视频资源文件,用户将上传pptx在页面预览,因此只能是将视频插入到pptx中,然后将pptx再转换成html在浏览器进行播放,唉,公司的脑回路没办法理解,只能服从……
pom.xml引入依赖
e-iceblue
spire.presentation
8.3.2
system
${basedir}/src/main/resources/lib/spire.presentation-8.3.2.jar
com.e-iceblue
e-iceblue
https://repo.e-iceblue.cn/repository/maven-public/
org.springframework.boot
spring-boot-maven-plugin
true
com.SoftUdiskApplication
JAR
![在这里插入图片描述](https://img-blog.csdnimg.cn/9c95241d0c674944ada515bbac656abf.png)
后端实现代码
package com.client.util;
import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;
/**
* @author:
* @creattime:2023-03-31 11:21
*/
public class PPTtoHTMLUtil {
public static void main(String[] args)throws Exception {
//创建Presentation类的对象
Presentation ppt = new Presentation();
//加载幻灯片文档
ppt.loadFromFile("E:/test/123.pptx");
//保存为HTML格式文档到指定路径
ppt.saveToFile("E:/test/FileToHtml.html", FileFormat.HTML)
ppt.dispose();
}
/**
* pptx转换为html
* @param pptxfile:pptx文件绝对路径
* @param htmlfile:生成的html文件绝对路径
* @return
*/
public static boolean covertpptxToHtml(String pptxfile,String htmlfile){
boolean result=false;
try {
//创建Presentation类的对象
Presentation ppt = new Presentation();
//加载幻灯片文档
ppt.loadFromFile(pptxfile);
//保存为HTML格式文档到指定路径
ppt.saveToFile(htmlfile, FileFormat.HTML);
ppt.dispose();
result=true;
}catch (Exception e){
e.printStackTrace();
result=false;
}
return result;
}
}
3.效果图 4.spire.presentation-8.3.2.jar下载流程 ①https://repo.e-iceblue.cn/repository/maven-public/ ② ③ ④ ⑤ ![在这里插入图片描述](https://img-blog.csdnimg.cn/009860e6926948febd66379e08a6f5a9.png)
注意:一定不能低于此版本,否则报各种错,本人就引了个低版本,调试到差点吐血哇
|